import request from '@/axios/axios'

// 设备激活折线图
export function activatedDevice(query) {
  return request({
    url: 'device/v1/statistical/activated/device',
    method: 'post',
    data: query
  })
}

// 设备活跃折线图
export function activeDevice(query) {
  return request({
    url: 'device/v1/statistical/active/device',
    method: 'post',
    data: query
  })
}

// 设备控制时长统计
export function controlDuration(query) {
  return request({
    url: 'device/v1/statistical/control/duration',
    method: 'post',
    data: query
  })
}

// 设备掉线次数统计
export function statisticalOffline(query) {
  return request({
    url: 'device/v1/statistical/offline/num',
    method: 'post',
    data: query
  })
}

// 统计导出
export function statisticalExport(query) {
  return request({
    url: 'device/v1/statistical/export',
    method: 'post',
    data: query,
    responseType: 'blob' // 强制axios将响应视为一个BLOB
  })
}

// 用户统计
export function statisticalUser(query) {
  return request({
    url: 'device/v1/statistical/register/user',
    method: 'post',
    data: query
  })
}

// 数据概况
export function situation(query) {
  return request({
    url: 'device/v1/statistical/general/situation',
    method: 'get'
  })
}

// 产品品类查询
export function category() {
  return request({
    url: '/device/v1/product/all/categories',
    method: 'get'
  })
}

// 列表查询产品信息
export function product(query) {
  return request({
    url: 'device/v1/product/list',
    method: 'post',
    data: query
  })
}
